unit RamoDM;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ZDataset, ZSqlUpdate, ZSequence, MainDM, QueryConditions, db;

type

  { TRamoData }

  TRamoData = class(TMainDataModule)
    RamoDatasource: TDatasource;
    RamoZQuerydesc_ramo: TStringField;
    RamoZQueryid_ramo: TLargeintField;
    RamoZSequence: TZSequence;
    RamoZUpdate: TZUpdateSQL;
    RamoZQuery: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  RamoData: TRamoData;

implementation

uses ConnectionDM;

{ TRamoData }


procedure TRamoData.DataModuleCreate(Sender: TObject);
begin
   MainDataSet := RamoZQuery;
   RamoZQuery.Open;
end;
procedure TRamoData.OpenDataSet;
begin
  //ConnectionData.EmptyQuery(RamoZQuery, 'ramo');
end;

procedure TRamoData.CloseDataSet;
begin
  //RamoZQuery.Close();
end;

procedure TRamoData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
    ConnectionData.OpenQueryConditions(RamoZQuery, Tabela, Condicoes);
end;

initialization
  {$I ramodm.lrs}

end.

